package com.xyh.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

/**
 * @author xiaoyh
 */
@RestController
public class LoginController {

    @Value("${server.port}")
    private String port;

    @GetMapping("/login")
    public String login() {
        Random random = new Random();
        if (random.nextBoolean()){
            throw new RuntimeException("login failed ！service port：" + port);
        }
        return "login success ! service port：" + port;
    }

}
